﻿#if ODIN_INSPECTOR
using Sirenix.OdinInspector;
#endif
using UnityEngine;

namespace JH
{
    /// <summary>
    ///  单个数据处理器的基类，在数据添加和移除时进行处理
    /// </summary>
    public abstract class EachProcessor<TPoint> : BasicMono<TPoint>, IProcessor<TPoint>
        where TPoint : struct
    {
        /// <summary>
        ///  图表数据
        /// </summary>
        private IChart<TPoint> _data;

        /// <summary>
        ///  图表数据
        /// </summary>
        public IChart<TPoint> Data => _data ??= this.GetChartComp<IChart<TPoint>,TPoint>();

        /// <summary>
        ///  处理器优先级
        /// </summary>
        [field: SerializeField]
#if ODIN_INSPECTOR
        [field:LabelText("处理器优先级")]
#endif
        public int Priority { get; set; }

        /// <summary>
        ///  加工图表数据
        /// </summary>
        public abstract void Process();
    }
}